package cn.wangsy.zhidao.p20170120;

public class SwapArray {

	public static void main(String[] args) {

		int arr[] = {1,2,3,4,5,6};
		print(arr);
		
		swap(arr, 0, 1);
		print(arr);
	}

	public static void swap(int []arr,int x,int y){
		int temp = arr[x];
		arr[x] = arr[y];
		arr[y] = temp;
	}
	
	public static void print(int []arr){
		for(int a:arr){
			System.out.print(a+"\t");
		}
		System.out.println();
	}
	
}
